package com.ccoffers.service.impl;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Required;

import com.ccoffers.dao.CRUDOperations;
import com.ccoffers.service.CRUDService;

public class CRUDServiceImpl<T> implements CRUDService<T> {

	private CRUDOperations<T> crudOperations;

	@Required
	public void setCrudOperations(CRUDOperations<T> crudOperations) {
		this.crudOperations = crudOperations;
	}
	public void update(T toUpdate) {
		crudOperations.update(toUpdate);
	}
	
	public T retrieve(Class<T> clazz, Serializable id) {
		return crudOperations.retrieve(clazz, id);
	}
	
	public void create(T toCreate) {
		crudOperations.create(toCreate);		
	}
	
	public void delete(T toDelete) {
		crudOperations.delete(toDelete);
	}
	
	public List<T> loadAll(Class<T> clazz) {
		return crudOperations.loadAll(clazz);
	}

}
